gridpack::utility::StringUtils Class Reference

#include <string_utils.hpp>

List of all members.

Public Member Functions

 StringUtils ()
 ~StringUtils ()
void trim (std::string &str)
void toUpper (std::string &str)
void toLower (std::string &str)
std::string clean2Char (std::string &string)
std::string trimQuotes (std::string &str)
std::vector< std::string > blankTokenizer (std::string &str)
std::vector< std::string > charTokenizer (std::string &str, const char *sep)
bool getBool (const char *str)
bool getBool (std::string str)

Constructor & Destructor Documentation

gridpack::utility::StringUtils::StringUtils (  ) 

Simple constructor

gridpack::utility::StringUtils::~StringUtils (  ) 

Simple destructor


Member Function Documentation

std::vector<std::string> gridpack::utility::StringUtils::blankTokenizer ( std::string &  str  ) 

Tokenize a string on blanks and return a vector of strings Blanks within single or double quotes are ignored

Parameters:
str string of tokens separated by blank characters
Returns:
vector containing individual tokens
std::vector<std::string> gridpack::utility::StringUtils::charTokenizer ( std::string &  str,
const char *  sep 
)

Tokenize a string on a user specified character string and return a vector of strings. This function does not pay attention to quotes

Parameters:
str input string
sep separator string
Returns:
vector containing individual tokens
std::string gridpack::utility::StringUtils::clean2Char ( std::string &  string  ) 

Clean up 2 character tags so that single quotes are removed and single character tags are right-justified. These tags can be delimited by a pair of single quotes, a pair of double quotes, or no quotes

Parameters:
string original string before reformatting
Returns:
2 character string that is right-justified
bool gridpack::utility::StringUtils::getBool ( std::string  str  ) 

References getBool().

bool gridpack::utility::StringUtils::getBool ( const char *  str  ) 

Convert a string into a bool value. This function will take a variety of strings can generate the corresponding bool. Acceptable values for "true" are "true", "yes", "t", "y", "1". Acceptable values for "false" are "false", "no", "f", "n", "0".

References toLower(), and trim().

void gridpack::utility::StringUtils::toLower ( std::string &  str  ) 

Convert all characters to lower case

Parameters:
str characters are converted for string str
void gridpack::utility::StringUtils::toUpper ( std::string &  str  ) 

Convert all characters to upper case

Parameters:
str characters are converted for string str
void gridpack::utility::StringUtils::trim ( std::string &  str  ) 

Remove white space from both ends of string

Parameters:
str string that needs white space removed
std::string gridpack::utility::StringUtils::trimQuotes ( std::string &  str  ) 

Trim any quotes from the beginning and end of a string

Parameters:
str string with quotes at beginning and end
Returns:
string with quotes and leading and trailing white space removed

References trim().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 3 Feb 2020 for GridPACK by  doxygen 1.6.1